package com.qianfeng.smartdevice.controller;

import com.qianfeng.smartdevice.dto.R;
import com.qianfeng.smartdevice.pojo.SysScene;
import com.qianfeng.smartdevice.service.SysSceneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.concurrent.ExecutionException;

/**
 * @time: 2022-03-21 20:25
 */
@RestController
@RequestMapping("/scenes")
public class SysSceneController {

    private SysSceneService sysSceneService;
    @Autowired
    public void setService(SysSceneService sysSceneService) {
        this.sysSceneService = sysSceneService;
    }
    @PostMapping("/scene")
    public R addScene(@RequestBody SysScene sysScene){
        sysSceneService.addSysScene(sysScene);
        return R.setOk();
    }
    @GetMapping("/scene/{id}")
    public R findById(@PathVariable Long id)throws ExecutionException {
        return R.setOk(sysSceneService.findById(id));
    }
}
